<?php

function zhuan(){
    $pdo->setAttrobute(PDO::ATR_AUTOCOMMIT,false);
    $pdo->beginTransaction();//开启一个事
    $sql = "insert into ddd set money = money-100";
    $a = $this->exec($sql);
    $sql1 = "insert into aaa set money = money+100";
    $b = $this->exec($sql1);
    if($a && $b){
        $pdo->commit();
    }else{
        $pdo->rollback();
    }
}

